<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>发帖</title>
    <style>
        #app {
            width: 80%;
            height: 300px;
            margin: 0 auto;
            background-color: #ddd;
        }
    </style>


</head>

<body>
    <div id="app">
        <button class="btn">获的app的css样式属性</button>

    </div>

</body>
<script>
    let btn = document.querySelector('.btn')
    btn.onclick = function () {
        //元素的css属性
        let width = getComputedStyle(app, null).width;
        console.log(width)
        let display = getComputedStyle(app, null).display;
        console.log(display)
        let bkc = getComputedStyle(app, null).backgroundColor;
        console.log(bkc)
        //元素属性
        let id = app.getAttribute('id')
        console.log(id)
        console.log(document.defaultView)
    }
</script>

</html>